<?php
if(!isset($intergrated))
{
header('Content-Type: text/xml');
header('Cache-control: no-cache');
}

include_once("./util/functs.php");
include_once("./util/util.php");

$link = mysql_connect('localhost', 'root', ''); //right now we are hardcoded..
if (!$link) 
{
   die('Could not connect: ' . mysql_error());
}

mysql_select_db("semf_test");

$property_name = $_GET['propertyName'];
$data_id = $_GET['dataId'];
$value = $_GET['value'];
$add_remove = $_GET['add_remove'];
databinding_updater($property_name, $data_id, $value, $add_remove);

$funct_name = $_GET['funct_name'];
$input_data = $_GET;
$input_vars = load_input_vars_from_data($input_data);
$output_vars = NULL;
if (!isset($funct_name) ||$funct_name == "")
{
$output_vars = page_on_load ($input_vars);
}
$return_data = echo_differences_of($input_vars, $output_vars);
echo $return_data;
// Handling the onLoad of Page0 
function Page0_onLoad ($args)
{
$query = "SELECT player.id  FROM Accreditation_Player player  WHERE player.name = 'x'";
$result = mysql_query($query) or die ("Error in query: $query ".mysql_error()); 
	$args['table']['player'] = array(); //initializing appropriately
	// see if any rows were returned
	if (mysql_num_rows($result) > 0) 
	{
		while($row = mysql_fetch_row($result)) 
		{
			// set the text
			$id = $row[0]; // this will give an id
			$args['table']['player'][$id] = array("id" => $id);
		}
	} 
$args['page']['year'] = "1983";
$args['page']['month'] = "Dec";
$args['page']['day'] = "2";
return $args;

} // end of the function Page0_onLoad

// Handling the common page_on_load function 
function page_on_load ($input_vars) 
{
$input_vars['page']['year'] = "";
$input_vars['page']['month'] = "";
$input_vars['page']['day'] = "";
// call function for Page0 
$output_vars = Page0_onLoad ($input_vars);
$input_vars = $output_vars; //now input will be last outputs;)
$output_vars["table"] = 
       update_databound_properties(NULL, $input_vars, 1);
return $output_vars;

} // end of the function page_on_load

// the following function will be called by util.php
// to update the values of databound properties
function update_databound_properties($diff_vars, $args, $starter)
{

$table_vars = array();

return $table_vars;
}
//finally the function for databinding_updater..
//responsible for update the databound properties
function databinding_updater($property_name, $data_id, $value, $add_remove)
{
if($property_name == NULL)
{
 return;
}

$update_query = NULL;


if($update_query != NULL)
{
 $result = mysql_query($update_query) or die ("Error in query: $update_query ".mysql_error());
}
}

mysql_close($link);
?>
